'''
Created on Feb 23, 2011

@author: Bogdan Mata
'''
import sys
import decimal

# Identifiers and Keywords
print(dir())
print(dir(__builtins__))

# Integral Types
i = 12
i += True
print(i)

#   Integers
x = 12
y = 13
print(x + y)
print(x - y)
print(x * y)
print(x / y)
print(x // y)
print(x % y)
print(x ** y)
print(-x)
print(+y)
print(abs(x))
print(divmod(x, y))
print(pow(x, y))
print(pow(x, y, 11))
print(round(x, 1))

print(bin(123456))
print(0b11110001001000000)
print(hex(123456))
print(0x1e240)
print(oct(123456))
print(0o361100)
print(int('123456'))
print(int('123456', 10))

print((123456).bit_length())

#    Booleans
x = True
y = False

# Floating-Point Types
print(0.0, 5.4)

# Floating-Point Numbers
print("epsilon", sys.float_info.epsilon)

# Complex Numbers
z = -89.5+2.125j
print(z.real, z.imag)
print(z.conjugate())

# Decimal Numbers
print(23 / 1.05)
print(decimal.Decimal(23) / decimal.Decimal("1.05"))

# Strings
text = """A triple quoted string like this can include 'quotes' and
"quotes" without formality. We can also escape newlines \
so this particular string is actually only two lines long."""
print(text)

a = "Single 'quotes' are fine; \"doubles\" must be escaped."
b = 'Single \'quotes\' must be escaped; "doubles" are fine.'
print(a)
print(b)

import re
phone1 = re.compile("^((?:[(]\\d+[)])?\\s*\\d+(?:-\\d+)?)$")
phone2 = re.compile(r"^((?:[(]\d+[)])?\s*\d+(?:-\d+)?)$")

t = "This is not the best way to join two long strings " + \
    "together since it relies on ugly newline escaping"
s = ("This is the nice way to join two long strings "
     "together; it relies on string literal concatenation.")
euros = "\N{euro sign} \u20AC \U000020AC"
print(euros)

# Comparing Strings
# Slicing and Striding Strings

